from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from ament_index_python.packages import get_package_share_directory
import os

def generate_launch_description():

    back_center_detection_node = Node(
        package='back_center_detection',
        executable='back_center_detector',
        name='back_center_detector',
        parameters=[
            PathJoinSubstitution([                    
                get_package_share_directory('center_detection'), 
                'config',
                'back_center_detector.params.yaml'
            ])   
        ],
        output='screen'
    )

    mqtt_cloud_sub_node = Node(
        package='mqtt_cloud_sub',
        executable='cloud_subscriber',
        name='cloud_subscriber',
        parameters=[
            PathJoinSubstitution([                    
                get_package_share_directory('mqtt_cloud_sub'), 
                'config',
                'cloud_subscriber.yaml'
            ])   
        ],
        output='screen'
    )
    

    return LaunchDescription([
        back_center_detection_node,
        mqtt_cloud_sub_node
    ])
